cmake_minimum_required(VERSION 3.10)
project(E2EEMessage)
#set(BUILD_TESTING 1)
#find_library(M_LIB m)
#include(libs/signal-protocol/CMakeModules/FindCheck.cmake)
##find_package(Check 0.9.10 REQUIRED)
#IF(NOT(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
#    find_package(OpenSSL 1.0 REQUIRED)
#ENDIF()
#find_package(Threads)
#include_directories(${CHECK_INCLUDE_DIRS})
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Test.out" CACHE PATH "Installation directory" FORCE)
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
#set(BUILD_TESTING 0)
add_subdirectory(libs/signal-protocol)

find_package(OpenSSL 1.0 REQUIRED)
#find_library(M_LIB m)
find_package(Threads)
message(STATUS "data ${OPENSSL_LIBRARIES}")
message(STATUS "data ${CMAKE_THREAD_LIBS_INIT}")
message(STATUS "data ${M_LIB}")

include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/libs/signal-protocol/src)
#include_directories(${CMAKE_SOURCE_DIR}/libs/signal-protocol/tests)
include_directories(.)


add_library(${PROJECT_NAME}
        OBJECT
        #        TeatMain.cpp
        Common.cpp
        E2EEFactory.cpp
        OPKManager.cpp
        GroupSession.cpp
        )
#set(TEST_PATH ${CMAKE_CURRENT_BINARY_DIR})
message(STATUS "data ${OPENSSL_LIBRARIES}")
target_link_libraries(${PROJECT_NAME}
        ${M_LIB}
        ${OPENSSL_LIBRARIES}
        ${CMAKE_THREAD_LIBS_INIT}
        ${CMAKE_DL_LIBS}
        signal-protocol-c
        )

add_executable(main TeatMain.cpp)
target_link_libraries(main ${PROJECT_NAME})

add_subdirectory(tests)